﻿using System;
using System.Data;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class TestJQuery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            DataTable table = new DataTable();
            table.Columns.Add("ID", typeof(int));
            table.Columns.Add("Name", typeof(string));
            table.Columns.Add("Salary", typeof(decimal));

            for (int i = 1; i < 8; i++)
            {
                DataRow row = table.NewRow();
                row["ID"] = i;
                row["Name"] = "Name " + i;
                row["Salary"] = 10000 * i;
                table.Rows.Add(row);
            }

            GridView1.DataSource = table;
            GridView1.DataBind();

            if (GridView1.Rows.Count > 0)
            {
                GridView1.UseAccessibleHeader = true;
                GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
            } 
        }
    }
}